﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using Visifire.Gauges;

namespace CPPEI.Coolzon.UI.DataPartLib
{
    public partial class DataGaugeBase
    {
        public MarkerIndicator SetMarkerIndicator(MarkerIndicator markerIndicator)
        {
            markerIndicator.BorderBrush = MarkerBorderBrush==null? null : MarkerBorderBrush.Brush;
            markerIndicator.BorderThickness = MarkerBorderThickness;
            markerIndicator.Background = MarkerBackground==null? null : MarkerBackground.Brush;
            markerIndicator.LabelBackground = MarkerLabelBackground==null? null : MarkerLabelBackground.Brush;
            markerIndicator.LabelEnabled = MarkerLabelEnabled;
            markerIndicator.LabelFontColor = MarkerLabelFontColor==null? null : MarkerLabelFontColor.Brush;
            markerIndicator.LabelFontFamily = MarkerLabelFontFamily;
            markerIndicator.LabelFontWeight = MarkerLabelFontWeight;
            markerIndicator.MarkerShape = MarkerShape;
            markerIndicator.Placement = MarkerPlacement;
            markerIndicator.ShadowEnabled = MarkerShadowEnabled;
            markerIndicator.ToolTipText = MarkerToolTipText;
            if (MarkerDistanceFromScale >= 0 && MarkerDistanceFromScale <= 1)
                markerIndicator.DistanceFromScale = MarkerDistanceFromScale;
            if (MarkerIndicatorLength >= 0 && MarkerIndicatorLength <= 1)
                markerIndicator.IndicatorLength = MarkerIndicatorLength;
            if (MarkerIndicatorWidth >= 0 && MarkerIndicatorWidth <= 1)
                markerIndicator.IndicatorWidth = MarkerIndicatorWidth;

            return markerIndicator;
        }
        private BrushEx markerBorderBrush;
        private Thickness markerBorderThickness;
        private BrushEx markerBackground;
        private BrushEx markerLabelBackground;
        private bool markerLabelEnabled;
        private BrushEx markerLabelFontColor;
        private FontFamily markerLabelFontFamily;
        private FontWeight markerLabelFontWeight;
        private Visifire.Gauges.Shapes markerShape;
        private PlacementTypes markerPlacement;
        private bool markerShadowEnabled;
        private string markerToolTipText;


        private double markerDistanceFromScale;
        private double markerIndicatorLength;
        private double markerIndicatorWidth;

        [Category("标识")]
        [DisplayName("标识边框颜色")]
        [Description("MarkerBorderBrush")]
        [Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "MarkerBorderBrush", "标识边框颜色")]
        public BrushEx MarkerBorderBrush
        {
            get
            {
                return markerBorderBrush;
            }

            set
            {
                markerBorderBrush = value;
                Refresh();
            }
        }

        [Category("标识")]
        [DisplayName("标识边框大小")]
        [Description("MarkerBorderThickness")]
        [Editor(typeof(UI.XProperty.Editors.XThicknessEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "MarkerBorderThickness", "标识边框大小")]
        public Thickness MarkerBorderThickness
        {
            get
            {
                return markerBorderThickness;
            }

            set
            {
                markerBorderThickness = value;
                Refresh();
            }
        }

        [Category("标识")]
        [DisplayName("标识背景颜色")]
        [Description("MarkerBackground")]
        [Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "MarkerBackground", "标识背景颜色")]
        public BrushEx MarkerBackground
        {
            get
            {
                return markerBackground;
            }

            set
            {
                markerBackground = value;
                Refresh();
            }
        }

        [Category("标识")]
        [DisplayName("标识标签背景颜色")]
        [Description("MarkerLabelBackground")]
        [Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "MarkerLabelBackground", "标识标签背景颜色")]
        public BrushEx MarkerLabelBackground
        {
            get
            {
                return markerLabelBackground;
            }

            set
            {
                markerLabelBackground = value;
                Refresh();
            }
        }

        [Category("标识")]
        [DisplayName("标识是否显示标签")]
        [Description("MarkerLabelEnabled")]
        [Editor(typeof(UI.XProperty.Editors.XBooleanEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "MarkerLabelEnabled", "标识是否显示标签")]
        public bool MarkerLabelEnabled
        {
            get
            {
                return markerLabelEnabled;
            }

            set
            {
                markerLabelEnabled = value;
                Refresh();
            }
        }

        [Category("标识")]
        [DisplayName("标识标签字体颜色")]
        [Description("MarkerLabelFontColor")]
        [Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "MarkerLabelFontColor", "标识标签字体颜色")]
        public BrushEx MarkerLabelFontColor
        {
            get
            {
                return markerLabelFontColor;
            }

            set
            {
                markerLabelFontColor = value;
                Refresh();
            }
        }

        [Category("标识")]
        [DisplayName("标识标签字体")]
        [Description("MarkerLabelFontFamily")]
        [Editor(typeof(UI.XProperty.Editors.XFontFamilyEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "MarkerLabelFontFamily", "标识标签字体颜色")]
        public FontFamily MarkerLabelFontFamily
        {
            get
            {
                return markerLabelFontFamily;
            }

            set
            {
                markerLabelFontFamily = value;
                Refresh();
            }
        }

        [Category("标识")]
        [DisplayName("标识标签字体粗细")]
        [Description("MarkerLabelFontWeight")]
        [Editor(typeof(UI.XProperty.Editors.XFontWeightEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "MarkerLabelFontWeight", "标识标签字体粗细")]
        public FontWeight MarkerLabelFontWeight
        {
            get
            {
                return markerLabelFontWeight;
            }

            set
            {
                markerLabelFontWeight = value;
                Refresh();
            }
        }

        [Category("标识")]
        [DisplayName("标识形状")]
        [Description("MarkerShape")]
        [Editor(typeof(UI.DataPartLib.XProperty.Editors.XShapesEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "MarkerShape", "标识形状")]
        public Shapes MarkerShape
        {
            get
            {
                return markerShape;
            }

            set
            {
                markerShape = value;
                Refresh();
            }
        }

        [Category("标识")]
        [DisplayName("标识位置")]
        [Description("MarkerPlacement")]
        [Editor(typeof(UI.DataPartLib.XProperty.Editors.XPlacementTypesEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "MarkerPlacement", "标识位置")]
        public PlacementTypes MarkerPlacement
        {
            get
            {
                return markerPlacement;
            }

            set
            {
                markerPlacement = value;
                Refresh();
            }
        }

        [Category("标识")]
        [DisplayName("标识是否显示阴影")]
        [Description("MarkerShadowEnabled")]
        [Editor(typeof(UI.XProperty.Editors.XBooleanEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "MarkerShadowEnabled", "标识是否显示阴影")]
        public bool MarkerShadowEnabled
        {
            get
            {
                return markerShadowEnabled;
            }

            set
            {
                markerShadowEnabled = value;
                Refresh();
            }
        }

        [Category("标识")]
        [DisplayName("标识提示")]
        [Description("MarkerToolTipText")]
        [Editor(typeof(UI.XProperty.Editors.XStringEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "MarkerToolTipText", "标识提示")]
        public string MarkerToolTipText
        {
            get
            {
                return markerToolTipText;
            }

            set
            {
                markerToolTipText = value;
                Refresh();
            }
        }

        [Category("标识")]
        [DisplayName("标识距离标尺距离(0-1)")]
        [Description("MarkerDistanceFromScale")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "MarkerDistanceFromScale", "标识距离标尺距离(0-1)")]
        public double MarkerDistanceFromScale
        {
            get
            {
                return markerDistanceFromScale;
            }

            set
            {
                markerDistanceFromScale = value;
                Refresh();
            }
        }

        [Category("标识")]
        [DisplayName("标识指针长度(0-1)")]
        [Description("MarkerIndicatorLength")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "MarkerIndicatorLength", "标识指针长度(0-1)")]
        public double MarkerIndicatorLength
        {
            get
            {
                return markerIndicatorLength;
            }

            set
            {
                markerIndicatorLength = value;
                Refresh();
            }
        }

        [Category("标识")]
        [DisplayName("标识指针宽度(0-1)")]
        [Description("MarkerIndicatorWidth")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "MarkerIndicatorWidth", "标识指针宽度(0-1)")]
        public double MarkerIndicatorWidth
        {
            get
            {
                return markerIndicatorWidth;
            }

            set
            {
                markerIndicatorWidth = value;
                Refresh();
            }
        }
    }
}
